package com.bitbakery.plugin.cl.module;

import com.bitbakery.plugin.cl.CLBundle;
import com.bitbakery.plugin.cl.CLIcons;
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
import com.intellij.ide.util.projectWizard.WizardContext;
import com.intellij.openapi.roots.ui.configuration.ModulesProvider;
import org.jetbrains.annotations.NonNls;

import javax.swing.*;
import java.util.ArrayList;

public class CLModuleType extends CLRunnableModuleType<CLModuleBuilder> {
    public static CLModuleType COMMON_LISP = new CLModuleType();

    @NonNls
    private static final String NEW_MODULE_NAME = "untitled";
    @NonNls
    private static final String COMMON_LISP_MODULE = "COMMON_LISP_MODULE";

    private CLModuleType() {
        super(COMMON_LISP_MODULE);
    }

    public String getNewModuleName() {
        return NEW_MODULE_NAME;
    }

    public final boolean isJ2EE() {
        return false;
    }

    public ModuleWizardStep[] createWizardSteps(WizardContext ctx, CLModuleBuilder builder, ModulesProvider provider) {
        ArrayList<ModuleWizardStep> steps = new ArrayList<ModuleWizardStep>();
        steps.add(new CLSelectLocationStep(ctx, builder, provider, CLIcons.COMMON_LISP_ADD_MODULE, null));
        steps.add(new CLModuleSelectJdkStep(ctx, builder, provider, CLIcons.COMMON_LISP_ADD_MODULE, null));
        return steps.toArray(new ModuleWizardStep[steps.size()]);
    }

    public CLModuleBuilder createModuleBuilder() {
        return new CLModuleBuilder();
    }


    public String getName() {
        return CLBundle.message("module.cl.title");
    }


    public String getDescription() {
        return CLBundle.message("module.cl.description");
    }


    public Icon getBigIcon() {
        return CLIcons.COMMON_LISP_MODULE;
    }


    public Icon getNodeIcon(boolean isOpened) {
        Icon icon = CLIcons.COMMON_LISP_MODULE_NODE_ICON;
        return isOpened ? icon : icon;
    }
}
